#include "common.h"
#include "util-files.h"

/***
 * 比较字符串 line 中是否包含字符串 word
 * @param line 
 * @param len 
 * @param word 
 * @param wlen  
 */ 
int isPresent(const uint8 *line, int len, const uint8 *word, int wlen)
{
    int i = 0, j = 0, flag = 0;
    char *temp1;
    char *temp2;

    while ((i++) < len)
    {
        if(*word == *line) {
            temp1 = line;
            temp2 = word;
            flag = 0;
            j = 0;
            while ((j++) < wlen)
            {
                if(*temp1 != *temp2) {
                    flag = 1;
                    break;
                }
                *temp1++;
                *temp2++;
            }
            return i;
        }
        *line++;
    }
    return KT_ERROR;
}